﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace 学生选课及成绩查询管理系统
{
    public partial class showStudentClassSituationInfo : Form
    {
        public showStudentClassSituationInfo()
        {
            InitializeComponent();
        }
        User user;

        internal User User
        {
            get { return user; }
            set { user = value; }
        }

        private void showStudentClassSituationInfo_Load(object sender, EventArgs e)
        {
            string sql = "select s1.classno as '班号',classname as '班名',stuname as '学生姓名',stugender as '性别（男为1，女为0）',stuage as '年龄' from student s1 join class on class.classno=s1.classno where (select s2.classno from student s2 where s2.stuno=" + user.Username + " )=s1.classno and class.clastate=1";
            DataTable dt=DBAccess.GetTable(sql);
            dataGridView1.DataSource = dt;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
